From e90188b9817e6064584e8ad22b52e01f2e5deb35 Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Mon, 25 Sep 2017 11:46:36 +0100 Subject: [PATCH] x86emul/test: generate non-pie executable for 64bit builds PIE may (and commonly will) result in the binary being loaded above the 4Gb boundary, which can't work with at least the VZEROUPPER compat mode test. Add -fno-PIE and -no-pie when appropriate so that gcc won't generate a PIE executable. Reported-by: Wei Liu Signed-off-by: Jan Beulich Signed-off-by: Wei Liu Acked-by: Jan Beulich --- tools/tests/x86_emulator/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/tests/x86_emulator/Makefile b/tools/tests/x86_emulator/Makefile index fd13ab53b1..fbe02cd2f9 100644 --- a/tools/tests/x86_emulator/Makefile +++ b/tools/tests/x86_emulator/Makefile @@ -76,7 +76,7 @@ $(addsuffix .c,$(SIMD)) $(addsuffix -avx.c,$(filter sse%,$(SIMD))): ln -sf simd.c $@ $(TARGET): x86_emulate.o test_x86_emulator.o - $(HOSTCC) -o $@ $^ + $(HOSTCC) $(HOSTCFLAGS) -o $@ $^ .PHONY: clean clean: @@ -98,7 +98,9 @@ asm: asm/%: asm ; -HOSTCFLAGS += $(CFLAGS_xeninclude) -I. +HOSTCFLAGS-x86_64 := -fno-PIE +$(call cc-option-add,HOSTCFLAGS-x86_64,HOSTCC,-no-pie) +HOSTCFLAGS += $(CFLAGS_xeninclude) -I. $(HOSTCFLAGS-$(XEN_COMPILE_ARCH)) x86.h := asm/x86-vendors.h asm/x86-defns.h asm/msr-index.h x86_emulate.h := x86_emulate.h x86_emulate/x86_emulate.h $(x86.h) -- 2.30.2